package fr.cephb.joperon.client;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class SubmitButton 
	extends Composite
	{
	private Element submit;
	
	public SubmitButton()
		{
		this.submit= DOM.createElement("input");
		this.submit.setAttribute("type","Submit");
		this.submit.setAttribute("value","Submit");
		this.submit.setAttribute("class","gwt-Button");
		initWidget(new Widget()
			{
			@Override
			public Element getElement() {
				return submit;
				}
			});
		}
	public SubmitButton(String name)
		{
		this(name,name);
		}
	
	public SubmitButton(String name,String value)
		{
		this();
		setName(name);
		setValue(value);
		}
	
	public void setValue(String value)
		{
		this.submit.setAttribute("value", value==null?"":value);
		}
	
	public String getValue()
		{
		return this.submit.getAttribute("value");
		}
	
	public void setName(String name)
		{
		this.submit.setAttribute("name", name==null?"":name);
		}

	public String getName()
		{
		return this.submit.getAttribute("name");
		}
	}
